package com.xfly.app.ui.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.widget.ListView;
import android.widget.TextView;

import com.ptmall.app.R;
import com.xfly.app.adapter.KcggAdapter;
import com.xfly.app.bean.KcggBean;

import java.util.ArrayList;
import java.util.List;


/**
 * Created by MacBook on 17/3/30.
 */

public class FfDialog {
    private Onclick onclick;
    public void setonclick(Onclick onclick){
        this.onclick =onclick;
    }
    private Dialog mDialog;
    private TextView qx,qd;
    public FfDialog(Context context) {
        View view = LayoutInflater.from(context).inflate(R.layout.dialog_ffyj,null);

        qx = view.findViewById(R.id.qx);
        qd = view.findViewById(R.id.qd);
        mDialog = new Dialog(context, R.style.dialogDim);
        mDialog.setContentView(view);
        mDialog.setCanceledOnTouchOutside(true);
        final Window win = mDialog.getWindow();
        win.setWindowAnimations(R.style.dialogAnim);

        qd.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mDialog.dismiss();

                onclick.Yes();
            }
        });
        qx.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mDialog.dismiss();
            }
        });

    }


    public void show() {
        mDialog.show();
    }

    public void dismiss() {
        mDialog.dismiss();
    }


    public interface Onclick{
        void Yes();
    }

    public boolean isshow(){
        if(mDialog.isShowing()){
            return true;
        }else {

            return false;
        }
    }

    public void setCanceledOnTouchOutside(boolean cacel) {
        if (null != mDialog) {
            mDialog.setCanceledOnTouchOutside(cacel);
        }
    }
}
